home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / windows / comms / recomm10.arj / COMFNC.C < prev    next >
C/C++ Source or Header  |  1993-10-12  |  2KB  |  120 lines

  1. #define CFILES 
  2. #include "recomsrv.h"  
  3.  
  4. static int rx = 512;
  5. static int tx = 512;
  6.  
  7.  
  8. BOOL FAR __cdecl  SRV_DEBUG( UINT DebugNr, char huge *szFormat, ...);
  9.  
  10. setque()
  11. {
  12.     rx = comData.a.qdb.cbqRx;
  13.     tx = comData.a.qdb.cbqTx;
  14.     
  15.     comData.rc = 0L;
  16. }    
  17. inicom()
  18. {           
  19.     char tmp[30];
  20.     
  21.     REMOTE_COM = comData.a.dcb.Id;
  22.     
  23.     GetPrivateProfileString("PORT", "COM", "COM2", tmp, sizeof(tmp), APPINI);
  24.                           
  25.     // setque kommt immer for inicom !!!   
  26.     
  27.     com = OpenComm(tmp, rx, tx);  
  28.     // lpevent = (int far *)SetCommEventMask(com, EV_ERR);
  29.     lpevent = &event[0];
  30.     evcnt = 0;
  31.     
  32.     if(com >= 0) 
  33.     {    comData.rc = 0;
  34.     }else
  35.     {    comData.rc = com;
  36.     }
  37.     
  38. }
  39. setcom()
  40. {
  41.     comData.a.dcb.Id = com;
  42.     comData.rc = SetCommState(&comData.a.dcb);
  43. }
  44. reccom()
  45. {
  46.     comData.rc = comData.len = ReadComm(com, &comData.a.x, 1);
  47. }
  48. sndcom()
  49. {
  50.     comData.rc = WriteComm(com, &comData.a.x, 1);
  51. }
  52. ctx()
  53. {
  54.     comData.rc = TransmitCommChar(com, (char)comData.a.x);
  55. }
  56. trmcom()
  57. {
  58.     comData.rc = CloseComm(com);
  59. }
  60. stacom()
  61. {
  62.     comData.rc = GetCommError(com, &comData.a.cs);
  63.     // SRV_DEBUG(1, "stacomm: inQ=%d, outQ=%d", comData.a.cs.cbInQue, comData.a.cs.cbOutQue);
  64. }
  65. cflush()
  66. {
  67.     comData.rc = FlushComm(com, comData.a.x);
  68. }
  69. cevt()
  70. {
  71.     lpevent = (int far *)SetCommEventMask(com, comData.a.x);
  72.     comData.rc = *lpevent;
  73. }           
  74. cextfcn()
  75. {
  76.     comData.rc = EscapeCommFunction(com, comData.a.x);    
  77. }
  78. cevtget()
  79. {
  80.     comData.rc = GetCommEventMask(com, comData.a.x);
  81. }
  82. csetbrk()
  83. {
  84.     comData.rc = SetCommBreak(com);
  85. }
  86. cclrbrk()
  87. {
  88.     comData.rc = ClearCommBreak(com);
  89. }
  90. getdcb()
  91. {
  92.     comData.rc = GetCommState(com, &comData.a.dcb);
  93.     comData.a.dcb.Id = REMOTE_COM;
  94. }
  95. cwstring()
  96. {
  97.     // SRV_DEBUG(1, "cwstring: len=%d", comData.len);
  98.     comData.rc = WriteComm(com, comData.a.txt, comData.len);
  99. }
  100. crstring()
  101. {                                                 
  102.     comData.rc = comData.len = ReadComm(com, comData.a.txt, comData.len);
  103.     // SRV_DEBUG(1, "crstring: len=%d", comData.len);
  104. }
  105. enablenoti()
  106. {
  107.     lpevent = &event[0];
  108.     evcnt = 0;
  109.     EnableCommNotification(REMOTE_COM, HwnD, comData.a.noti.inTrig, comData.a.noti.outTrig);
  110.     comData.rc = TRUE;
  111. }
  112.  
  113.     
  114.  
  115.  
  116.  
  117.     
  118.     
  119.  
  120.